<!--
轮播图的部分
-->
<template>
  <div class="root">
    <!-- :list='imgs' auto  -->
    <Swiper auto loop dots-position='center' 
    stle='height:140px'>
      <Swiper-Item v-for='page in fixArray'>
        <SwiperDiv :items='page'></SwiperDiv>
      </Swiper-Item>

    </Swiper>
  </div>
</template>
 
<script>
import { Swiper , SwiperItem } from 'vux'
import SwiperDiv from './SwiperDiv'
export default {
  props:['swiperArray'],
  components: {
    Swiper,
    SwiperItem,
    SwiperDiv
  },
  computed:{
    // 每八个放在一个数组中,然后把数组在放入数组中------> (不懂)
    fixArray(){
      var big =[]
      var sm = []
      for(var i = 0;i<this.swiperArray.length;i++){
        sm.push(this.swiperArray[i]);
        if((i+1)%8==0|| i==this.swiperArray.length-1){
          big.push(sm)
          sm=[]
        }
      }
      return big;
    }
  }
}
</script>

<style scoped>
  .root{
    background-color: white;
  }
</style>
